"""
点乘(Hadamard)：两个同纬数组对应位置的元素相乘
语法：
    torch.mul(tensor1, tensor2)  => 点乘
    tensor1 * tensor2
"""
import torch
import torch as t

# 方式一
data1 = t.randint(0, 10, [3, 4])
data2 = t.randint(0, 10, [3, 4])
print("data1:", data1)
print("data2:", data2)
data = torch.mul(data1, data2)
print(data)

# 方式二
data = torch.mul(data1, data2)
print(data)
